﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace JobSchedule.Extension
{
    public static class SerializeExtension
    {
        public static T JsonToObject<T>(this string jsonFileName) where T : class
        {
            var jsonPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, jsonFileName);
            string json;
            using (var reander = File.OpenText(jsonPath))
            {
                json = reander.ReadToEnd();
            }
            return JsonConvert.DeserializeObject<T>(json);
        }
    }
}
